package com.jk.wh.controller;

import com.jk.*;
import com.jk.service.wh.MovieApi;
import com.jk.wh.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class MovieController implements MovieApi {

    @Autowired
    private MovieService movieService;
    @Autowired
    private MongoTemplate mongoTemplate;
    /**
     * @Author: wh
     * @Description: 电影查询（各种条查）
     * @Date: 2021/5/20 22:55
     * @Param:[movie]
     * @Return: java.util.List<com.jk.MovieBean>
     **/
    @Override
    public List<MovieBean> queryMovie(MovieBean movie) {
        return movieService.queryMovie(movie);
    }
    /*
    * @Author: xz
    * @Description: 查询正在热映的电影
    * @Date: 2021/5/21 14:53
    * @Param:[]
    * @Return: java.util.List<com.jk.MovieBean>
    **/
    @Override
    public List<MovieBean> getRadientMovie() {
        return movieService.getRadientMovie();
    }
    /*
    * @Author: xz
    * @Description: 查询待上映的电影
    * @Date: 2021/5/21 15:15
    * @Param:[]
    * @Return: java.util.List<com.jk.MovieBean>
    **/
    @Override
    public List<MovieBean> waitMovie() {
        return movieService.waitMovie();
    }
    /*
    * @Author: xz
    * @Description: 查询最受期待电影前10
    * @Date: 2021/5/21 16:06
    * @Param:[]
    * @Return: java.util.List<com.jk.MovieBean>
    **/
    @Override
    public List<MovieBean> expectMovie() {
        return movieService.expectMovie();
    }
    /*
    * @Author: xz
    * @Description: 查询前10的高评分电影
    * @Date: 2021/5/21 17:08
    * @Param:
    * @Return:
    **/
    @Override
    public List<MovieBean> getScore() {

        return movieService.getScore();
    }
    /*
     * @Author: xz
     * @Description: 查询已上映的总条数
     * @Date: 2021/5/24 9:56
     * @Param:
     * @Return:
     **/
    @Override
    public Integer getMovieCount() {
        return movieService.getMovieCount();
    }
    /*
     * @Author: xz
     * @Description: 查询待上映的总条数
     * @Date: 2021/5/24 9:56
     * @Param:
     * @Return:
     **/
    @Override
    public Integer getMovieCount2() {
        return  movieService.getMovieCount2();
    }

    @Override
    public List<CarouselBean> getCarousel() {
        return movieService.getCarousel();
    }
   /*
   * @Author: xz
   * @Description: 查询类型表
   * @Date: 2021/5/25 15:50
   * @Param:[]
   * @Return: java.util.List<com.jk.MovieTypeBean>
   **/
    @Override
    public List<MovieTypeBean> getType() {
        return movieService.getType();
    }
    //查询条查总条数
    @Override
    public Integer getMovieCountByStatus(String movieName) {
        return movieService.getMovieCountByStatus(movieName);
    }

    /**
    * @Author: wh
    * @Description: 生成未支付订单存redis
    * @Date: 2021/5/26 10:36
    * @Param:[order]
    * @Return: void
    **/
    @Override
    public void saveRedis(OrderBean order) {
        movieService.saveRedis(order);
    }
    //查询热播电影
    @Override
    public List<MovieBean> queryHitTv(MovieBean mm) {
        return movieService.queryHitTv(mm);
    }
    //获取票房排行前五名
    @Override
    public List<MovieBean> getMoney() {
        return movieService.getMoney();
    }


    /**
    * @Author: wh
    * @Description:删除redis 存入mongodb
    * @Date: 2021/5/26 16:39
    * @Param:[orderId]
    * @Return: void
    **/
    @Override
    public void saveOrder(@RequestBody OrderBean order) {
        movieService.saveOrder(order);
    }
    /*
    * @Author: xz
    * @Description: 查询影院
     * @Date: 2021/5/27 11:22
    * @Param:[cc]
    * @Return: java.util.List<com.jk.CinemaBean>
    **/
    @Override
    public List<CinemaBean> queryCinemaAll(CinemaBean cc) {
        return movieService.queryCinemaAll(cc);
    }
   /*
   * @Author: xz
   * @Description: 根据id查询影院
   * @Date: 2021/5/27 17:07
   * @Param:[cinemaId]
   * @Return: com.jk.CinemaBean
   **/
    @Override
    public CinemaBean buyTicketById(Integer cinemaId) {
        return movieService.buyTicketById(cinemaId);
    }
    /*
    * @Author: xz
    * @Description: 根据影院id查询影院对应的电影
    * @Date: 2021/5/27 21:45
    * @Param:[cinemaId]
    * @Return: java.util.List<com.jk.MovieBean>
    **/
    @Override
    public List<MovieBean> queryMovieAllById(Integer cinemaId) {
        return movieService.queryMovieAllById(cinemaId);
    }
    /*
    * @Author: xz
    * @Description: 根据影院id 电影id查看观影时间
    * @Date: 2021/5/28 17:40
    * @Param:[cinemaId, movieId]
    * @Return: java.util.List<com.jk.MovieBean>
    **/
    @Override
    public List<MovieBean> getMovieCinemaById(Integer cinemaId, Integer movieId, String date) {
        return movieService.getMovieCinemaById(cinemaId,movieId,date);
    }
    /*
    * @Author: xz
    * @Description: 根据影院id 电影id查询影院对应的电影
    * @Date: 2021/5/28 20:57
    * @Param:[cinemaId, movieId]
    * @Return: com.jk.MovieBean
    **/
    @Override
    public MovieBean getMovies2(Integer cinemaId, Integer movieId) {
        return movieService.getMovies2(cinemaId,movieId);
    }
    /*
    * @Author: xz
    * @Description: 动态查询排片时间
    * @Date: 2021/5/30 10:31
    * @Param:[cinemaId, movieId]
    * @Return: java.util.List<com.jk.ProgramBean>
    **/
    @Override
    public List<ProgramBean> getDate(Integer cinemaId, Integer movieId) {
        return movieService.getDate(cinemaId,movieId);
    }
    /*
    * @Author: xz
    * @Description: 获取影院
    * @Date: 2021/5/30 21:03
    * @Param:[]
    * @Return: java.util.List<com.jk.CinemaBean>
    **/
    @Override
    public List<CinemaBean> getCinema() {
        return movieService.getCinema();
    }
    /*
     * @Author: xz
     * @Description:获取西安市的区
     * @Date: 2021/5/30 21:06
     * @Param:
     * @Return:
     **/
    @Override
    public List<AddressBean> getAddressById() {
        return movieService.getAddressById();
    }
    /*
    * @Author: xz
    * @Description: 查询影厅
    * @Date: 2021/5/30 21:23
    * @Param:[]
    * @Return: java.util.List<com.jk.MovieHallBean>
    **/
    @Override
    public List<MovieHallBean> getHall() {
        return movieService.getHall();
    }


}
